package com.vercon.commonmirror.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.vercon.commonmirror.base.BaseEvent;
import com.vercon.commonmirror.utils.LogUtils;

import org.greenrobot.eventbus.EventBus;

import java.util.Objects;

/**
 * Created by csh on 2020/7/10
 */
public class TimerBroadCast extends BroadcastReceiver {

    public static final String MINUTES = "MINUTES";
    public static final String HOUR = "HOUR";
    public static final String DAY = "DAY";

    @Override
    public void onReceive(Context context, Intent intent) {
        LogUtils.e("TimerBroadCast 定时器执行");
        switch (Objects.requireNonNull(intent.getAction())) {
            case Intent.ACTION_TIME_TICK:
                //每过一分钟 触发
                EventBus.getDefault().post(new BaseEvent(MINUTES));
                break;
            case Intent.ACTION_TIME_CHANGED:
                //设置了系统时间
                break;
            case Intent.ACTION_TIMEZONE_CHANGED:
                //设置了系统时区的action
                break;
        }

    }

}


